﻿#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
void meun()
{
	printf("--------------------------\n");
	printf("-----1.开始游戏 0.退出游戏\n");
	printf("--------------------------\n");
}
void game()
{
	srand((unsigned int)time(NULL));
	int ret = rand() % 100 + 1;
	int s;
	while (1)
	{
		printf("请输入：\n");
		scanf("%d", &s);
		if (s > ret)
		{
			printf("猜大了\n");
		}
		else if(s<ret)
		{
			printf("猜小了\n");
		}
		else
		{
			printf("猜对了\n");
			break;
		}
	}
}
int main()
{
	int input;
	do
	{
		meun();
		printf("请选择：\n");
		scanf("%d", &input);
		switch (input)
		{
		case 1:
			game();
			break;
		case 0:
			printf("退出游戏！\n");
			break;
		default :
			printf("选择错误，请重新选择！\n");
			break;
		}
	} while (input);
	return 0;
}